// @ts-nocheck
import { randomNum } from '../format-map-data.js';

export default {
  async heatMapClickType({ type = '', layerIndex = 0, coordinatesSystem = 'cgcs2000' } = {}) {
    const self = this;
    if (type == '清除热力图') {
      // 增删改 一体 覆盖写入方法
      // 热力图
      await self.vickMapPostMessage({
        key: 'editLayerOverlayHeatMap',
        value: {
          layerIndex: layerIndex
        }
      });
    } else if (type == '添加热力图') {
      let resultJson = [];
      for (let i = 0; i < 1000; i++) {
        let coordinates = [
          randomNum(-78.8137112298911, -73.0218395662503, 7),
          randomNum(41.228852248049925, 44.9618393387994, 7)
        ];
        resultJson.push({
          coordinates: coordinates,
          count: parseInt(randomNum(10, 100))
        });
      }
      await self.vickMapPostMessage({
        key: 'editLayerOverlayHeatMap',
        value: {
          layerIndex: layerIndex,
          opacity: 0.75,
          gradient: { 0.3: '#00f', 0.5: '#0f0', 0.7: '#ff0', 0.95: '#f00' },
          radius: 10.0,
          blur: 0.85,
          maxCount: 100.0,
          resultJson: resultJson,
          coordinatesSystem: coordinatesSystem
        }
      });
    }
  }
};
